<!-- 
 * layouts页面
 * @author: 
 * @since: 2022-04-06
 * index.vue
-->
<template>
  <div class="management-system-container">
    <Mobile v-if="isMobile" />
    <el-container class="container-box" v-else>
      <Menu :isCollapse="isCollapse" class="hidden-xs-only"></Menu>
      <el-container class="container" :style="{ width: isWidth }">
        <el-header class="header" :style="{ width: isWidth }">
          <NavBar @handleCollapse="handleCollapse" />
          <template v-if="tag">
            <TabBar />
          </template>
        </el-header>
        <el-main class="main">
          <AppMain />
        </el-main>
        <footer class="footer">
          <span>{{ copyrightStr }}</span>
        </footer>
      </el-container>
    </el-container>
  </div>
</template>

<script setup>
import { computed, ref } from 'vue';
import { useStore } from 'vuex';
import { setting } from '@/config/setting';
const { copyright } = setting;
const store = useStore();
const copyrightStr = ref(copyright);

const isWidth = computed(() => {
  return { width: isCollapse ? 'calc(100vw - 65px)' : 'calc(100vw - 240px)', }
});
const isMobile = computed(() => {
  return store.getters['setting/isMobile'];
});
const isCollapse = computed(() => {
  return store.getters.collapse;
});
const tag = computed(() => {
  return store.getters['setting/tag'];
});
const handleCollapse = () => {
  store.dispatch('setting/changeCollapse');
};

</script>

<style lang="scss" scoped>
.management-system-container {
  height: 100%;
  .container-box {
    display: flex;
    height: 100%;
  }
  .container {
    height: 100%;
    flex: 1;
    display: flex;
    flex-direction: column;
    transition: all $base-transition-time-4;
  }
  .header {
    width: 100%;
    padding: 0;
    height: auto;
    transition: all $base-transition-time-4;
  }
  .main {
    flex: 1;
    background-color: #f0f3fb;
    overflow: hidden;
    padding: 10px 10px 0 10px;
    box-sizing: border-box;
  }
  .footer {
    min-height: $footer-copyright-height;
    color: #afb9d2;
    text-align: center;
    background-color: #f0f3fb;
    font-size: $base-font-size-small;
    line-height: $footer-copyright-height;
  }
}
</style>
